package com.feige.pojo.dto;



import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.util.Arrays;

/**
 * @author feige
 */
@ApiModel(value="UserDto对象")
public class UserDto {

    @ApiModelProperty(value = "ID")
    private Long id;

    @NotBlank(message = "学号不能为空")
    @ApiModelProperty(value = "学号")
    private String num;

    @NotBlank(message = "用户名不能为空")
    @ApiModelProperty(value = "用户名")
    private String username;

    @ApiModelProperty(value = "性别")
    private Integer sex;

    @ApiModelProperty(value = "头像")
    private String avatar;

    @ApiModelProperty(value = "备注")
    private String remark;

    @JsonIgnore
    @Size(min = 6,max = 18,message = "密码长度必须在6~18位")
    @ApiModelProperty(value = "密码")
    private String password;

    @NotBlank(message = "昵称不能为空")
    @ApiModelProperty(value = "昵称")
    private String nickname;

    @Size(min = 11, max = 11, message = "手机号码长度不能超过或小于11个字符")
    @ApiModelProperty(value = "电话号码")
    private String phoneNumber;

    @Email(regexp = "^[a-zA-Z0-9_.-]+@[a-zA-Z0-9-]+(\\.[a-zA-Z0-9-]+)*\\.[a-zA-Z0-9]{2,6}$",message = "邮箱格式不正确")
    @Size(min = 8, max = 50, message = "邮箱长度不能超过50个字符")
    @ApiModelProperty(value = "邮箱")
    private String email;


    @ApiModelProperty(value = "部门ID")
    private Long deptId;

    @ApiModelProperty(value = "所管理的部门ID")
    private String manageDeptIds;

    @ApiModelProperty(value = "状态（0表示禁用，1表示可用）")
    private Integer status;

    @ApiModelProperty(value = "权限ID")
    private Long[] roleIds;

    public UserDto() {
    }

    public UserDto(Long id, String num, String username, Integer sex, String avatar, String remark, String password, String nickname, String phoneNumber, String email, Long deptId, String manageDeptIds, Integer status, Long[] roleIds) {
        this.id = id;
        this.num = num;
        this.username = username;
        this.sex = sex;
        this.avatar = avatar;
        this.remark = remark;
        this.password = password;
        this.nickname = nickname;
        this.phoneNumber = phoneNumber;
        this.email = email;
        this.deptId = deptId;
        this.manageDeptIds = manageDeptIds;
        this.status = status;
        this.roleIds = roleIds;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getNum() {
        return num;
    }

    public void setNum(String num) {
        this.num = num;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public Integer getSex() {
        return sex;
    }

    public void setSex(Integer sex) {
        this.sex = sex;
    }


    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getNickname() {
        return nickname;
    }

    public void setNickname(String nickname) {
        this.nickname = nickname;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Long getDeptId() {
        return deptId;
    }

    public void setDeptId(Long deptId) {
        this.deptId = deptId;
    }

    public String getManageDeptIds() {
        return manageDeptIds;
    }

    public void setManageDeptIds(String manageDeptIds) {
        this.manageDeptIds = manageDeptIds;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public Long[] getRoleIds() {
        return roleIds;
    }

    public void setRoleIds(Long[] roleIds) {
        this.roleIds = roleIds;
    }

    @Override
    public String toString() {
        return "UserDto{" +
                "id=" + id +
                ", num='" + num + '\'' +
                ", username='" + username + '\'' +
                ", sex=" + sex +
                ", avatar='" + avatar + '\'' +
                ", remark='" + remark + '\'' +
                ", password='" + password + '\'' +
                ", nickname='" + nickname + '\'' +
                ", phoneNumber='" + phoneNumber + '\'' +
                ", email='" + email + '\'' +
                ", deptId=" + deptId +
                ", manageDeptIds='" + manageDeptIds + '\'' +
                ", status=" + status +
                ", roleIds=" + Arrays.toString(roleIds) +
                '}';
    }
}
